const { querySql , updateSql, insertSql , deleteSql } = require('../db')


function getAreaList(query) {
  const { areaName } = query
  return querySql(`select * from teachingArea_list where areaName like '%${areaName || ''}%'`)
}

function editArea(query){
  return updateSql( query , 'teachingArea_list' , `where id = ${query.id}` )
}

function createArea(query){
  return insertSql( query , 'teachingArea_list' )
}

function deleteArea(query){
  return deleteSql('id',query.id,'teachingArea_list')
}

module.exports = {
  getAreaList,
  editArea,
  createArea,
  deleteArea
} 